package com.cgc.venus.server.user.inter;
import com.cgc.venus.server.core.exception.VenusException;
import com.cgc.venus.server.core.harbor.model.Project;
import com.cgc.venus.server.user.bean.Namespace;
import com.cgc.venus.server.user.bean.Team;
import com.cgc.venus.server.user.bean.TeamNamespace;
import com.cgc.venus.server.user.bean.namespaceUser;
import java.util.List;
/**
 * Created by 业哥 on 2017/9/6.
 * 团队管理服务接口
 */
public interface TeamService {
    /**
     * 查询团队信息
     * @param queryKey
     * @param currentUserId
     * @param isSuperAdmin
     * @return
     * @throws VenusException
     */
    public List<Team> teamQuery(String queryKey,String currentUserId,boolean isSuperAdmin)throws VenusException;

    /**
     * 团队查询
     * @param userId
     * @param isSuperAdmin
     * @return
     * @throws VenusException
     */
    public List teamQuery(String userId,boolean isSuperAdmin)throws VenusException;


    /**
     * 空间查询
     * @param userId
     * @param teamId
     * @param isSuperAdmin
     * @return
     * @throws VenusException
     */
    public List namespaceQuery(String userId,String teamId,boolean isSuperAdmin)throws VenusException;

    /**
     * 根据团队id查询明细
     * @param teamId
     * @return
     * @throws VenusException
     */
    public Team teamDetailQuery(String teamId)throws VenusException;

    /**
     * 根据命名空间id查询用户对应用户信息
     * @param namespaceId
     * @return
     * @throws VenusException
     */
    public List<namespaceUser> namespaceUserSelectQuery(String namespaceId)throws VenusException;

    /**
            *团队名称唯一性验证
    * @param name
    * @param type (cn/en)
    * @return
            * @throws VenusException
    */
    public boolean validateTeamName(String name,String type)throws VenusException;

    /**
     * 团队新增
     * @return
     * @throws VenusException
     */
    public boolean teamAdd(Team team,String currentUserId)throws VenusException;

    /**
     * 团队修改
     * @return
     * @throws VenusException
     */
    public boolean teamUpdate(Team team)throws VenusException;


    /**
     * 团队停用 根据id
     * @param id
     * @return
     * @throws VenusException
     */
    public boolean teamDisableById(String id)throws VenusException;

    /**
     * 物理分区查询
     *[{
     label: '共享物理组',
     options: [{
     value: '001',
     label: '共享物理组1'
     }]
     }, {
     label: '平台专用物理组',
     options: [{
     value: '003',
     label: '平台专用物理组1'
     }, {
     value: '004',
     label: '平台专用物理组2'
     }]
     }, {
     label: '应用系统物理组',
     options: [{
     value: '005',
     label: '应用系统物理组1'
     }, {
     value: '006',
     label: '应用系统物理组2'
     }]
     }]
     * @return
     * @throws VenusException
     */
    public List physicalGroupQuery()throws VenusException;

    /**
     * 团队命名空间物理分组设置
     * @param namespaceIds
     * @param physicalGroupId
     * @return
     * @throws VenusException
     */
    public boolean teamNamespacePhysicalGroupSet(String[] namespaceIds, String physicalGroupId)throws VenusException;

    /**
     * 命名空间可选用户查询(用户列表 用于团队空间选择用户的备选用户,排除该命名空间下面已经存在的用户).格式如下:
     * [{
     label: '开发人员',
     options: [{
     value: '001',
     label: '开发人员1'
     }, {
     value: '002',
     label: '开发人员2'
     }]
     }, {
     label: '测试人员',
     options: [{
     value: '003',
     label: '测试人员1'
     }, {
     value: '004',
     label: '测试人员2'
     }]
     }, {
     label: '运维人员',
     options: [{
     value: '005',
     label: '运维人员1'
     }, {
     value: '006',
     label: '运维人员2'
     }]
     }]
     * @return
     * @throws VenusException
     */
    public List namespaceUserUnSelectQuery(String namespaceId)throws VenusException;

    /**
     * 命名空间添加用户
     * @param namespaceId
     * @param userId
     * @return
     * @throws VenusException
     */
    public boolean namespaceAddUser(String namespaceId,String[] userId)throws VenusException;

    /**
     *
     * @param namespaceId
     * @param userId
     * @return
     * @throws VenusException
     */
    public boolean namespaceRemoveUser(String namespaceId,String[] userId)throws VenusException;
    //获取默认物理组id
    public String getDefaultPhysicalGroupId()throws VenusException;

    /**
     * 命名空间查询
     * @param teamId
     * @return
     */
    public List<Namespace> namespaceQuery(String teamId)throws VenusException;

    /**
     * 命名空间新增
     * @param teamId
     * @return
     */
    public Boolean namespaceAdd(String teamId,Namespace namespace)throws VenusException;

    /**
     * 命名空间停用
     * @param teamId
     * @param namespaceId
     * @return
     */
    public Boolean namespaceDisable(String teamId,String[] namespaceId)throws VenusException;

    /**
     * k8s的namespace以及harbor的项目名称唯一性验证
     * @param name
     * @param type (name/k8s/harbor)
     * @return
     * @throws VenusException
     */
    public boolean validateNamespaceName(String name,String type)throws VenusException;

    /**
     * 团队与命名空间统计 用于首页
     * @return
     * @throws VenusException
     */
    public List teamAndNamespaceStats()throws VenusException;

    /*
    * 创建harbor秘钥
    * */
    public boolean createHarborSecret(String namespace) throws VenusException;

}